/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package rad.Java.MotelPlus.Class;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import rad.Java.Common.Class.DefaultClass;
import rad.Java.Common.Class.IClass;

/**
 *
 * @author rogerio
 */
public class SaleDetail extends DefaultClass implements IClass{
    // <editor-fold defaultstate="collapsed" desc="Declaration of variables">
        private String _product_id;
        private String _employee_id;
        private String _sale_id;
        private String _price;
        private String _amount;
    // </editor-fold>

    public SaleDetail()
    {
        _gsql.setTable("sale_detail");
        _sequence = "sale_detail_sale_detail_id_seq";
    }

    // <editor-fold defaultstate="collapsed" desc="Declaration of methods Get and Set">
        public String getEmployee_id() {
            return _employee_id;
        }

        public void setEmployee_id(String _employee_id) {
            this._employee_id = _employee_id;
        }

        public String getPrice() {
            return _price;
        }

        public void setPrice(String _price) {
            this._price = _price;
        }

        public String getProduct_id() {
            return _product_id;
        }

        public void setProduct_id(String _product_id) {
            this._product_id = _product_id;
        }

        public String getSale_id() {
            return _sale_id;
        }

        public void setSale_id(String _sale_id) {
            this._sale_id = _sale_id;
        }

        public String getAmount() {
            return _amount;
        }

        public void setAmount(String _amount) {
            this._amount = _amount;
        }


    // </editor-fold>

    // <editor-fold defaultstate="collapsed" desc="Declaration of functions">
        public void clear() {
            _id                     = "";
            _product_id             = "";
            _employee_id            = "";
            _sale_id                = "";
            _price                  = "";
            _amount                 = "";
        }

        @Override
        public void get(ResultSet rs) {
            try {
                _id                     = rs.getString("sale_detail_id");
                _product_id             = rs.getString("sale_detail_product_id");
                _employee_id            = rs.getString("sale_detail_employee_id");
                _sale_id                = rs.getString("sale_detail_sale_id");
                _price                  = rs.getString("sale_detail_price");
                _amount                 = rs.getString("sale_detail_amount");
            } catch (SQLException ex) {
                Logger.getLogger(SaleDetail.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        @Override
        public void setGsql() {
            _gsql.setValue( _id                 , "sale_detail_id");
            _gsql.setValue( _product_id         , "sale_detail_product_id");
            _gsql.setValue( _employee_id        , "sale_detail_employee_id");
            _gsql.setValue( _sale_id            , "sale_detail_sale_id");
            _gsql.setValue( _price              , "sale_detail_price");
            _gsql.setValue(_amount              , "sale_detail_amount");
        }
    // </editor-fold>
}
